package com.xiaoq.oauth2;

/**
 * @author xinpeng created on 16/8/1-下午3:44.
 */
public enum OAuth2SvrErrorCode {

    /*
状态码	含义	                    说明
200	    OK	                    请求成功
201	    CREATED	                创建成功
202	    ACCEPTED	            更新成功
400	    BAD REQUEST	            请求的地址不存在或者包含不支持的参数
401	    UNAUTHORIZED	        未授权
403	    FORBIDDEN	            被禁止访问
404	    NOT FOUND	            请求的资源不存在
500	    INTERNAL SERVER ERROR	 内部错误

*/

/*
    错误码	   错误信息	            含义	                                              status code
    1100	NEED_AUTH_CODE	      需要授权码	                                             403
    1101	INVALID_AUTH_CODE	  无效的授权码	                                         403
    1102	AUTH_CODE_EXPIRED	  授权码过期	                                             403
    1103	NEED_ACCESS_TOKEN	  需要access_token	                                     401
    1104	NEED_REFRESH_TOKEN	  需要refresh_token	                                     403
    1105	INVALID_ACCESS_TOKEN  无效的access_token	                                 403
    1106	INVALID_REFRESH_TOKEN 无效的refresh_token	                                 403
    1107	ACCESS_TOKEN_EXPIRED	       Token过期了	                                         403
    1108	NEED_REDIRECT_URI	   需要重定向URI	                                         400


*/


    NEED_AUTH_CODE(1100,403,"需要授权码"),
    INVALID_AUTH_CODE(1101,403,"无效的授权码"),
    AUTH_CODE_EXPIRED(1102,403,"授权码过期"),

    NEED_ACCESS_TOKEN(1103,401,"需要访问令牌"),
    NEED_REFRESH_TOKEN(1104,403,"需要刷新令牌"),

    NEED_REDIRECT_URI(1107,400,"需要重定向URI");

    public int errorCode;
    public int httpStatus;
    public String errorMsg;

    OAuth2SvrErrorCode(int errorCode, int httpStatus,String errorMsg) {
        this.errorCode = errorCode;
        //RFC2616中定义的HttpStatus
        this.httpStatus = httpStatus;
        this.errorMsg = errorMsg;
    }

}
